package com.umakr.ax.core;

import com.umakr.ax.utils.WebUtil;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;

import java.util.Map;

/**
 *
 * @author Administrator
 * @date 2015/10/14
 */
public final  class AppInitializer {
    private AppInitializer() {
        throw new IllegalStateException("AppInitializer class");
    }

    public static void init(ApplicationContext rootAppContext){
        for(Map.Entry<String,Object> entry : WebUtil.getBeanWithAnnotation(Configuration.class).entrySet()){
            Object obj = entry.getValue();
            if(obj instanceof ModuleInit){
                ModuleInit moduleInit = ((ModuleInit)obj);
                moduleInit.moduleInit(rootAppContext);
            }
        }

    }



}
